// 添加sequelize实例的导入
const { sequelize } = require('../config/db');
const { DataTypes } = require('sequelize');

const Vaccine = sequelize.define('Vaccine', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  type_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
    comment: '疫苗类型ID',
  },
  name: {
    type: DataTypes.STRING(200),
    allowNull: false,
    comment: '疫苗名称'
  },
  manufacturer: {
    type: DataTypes.STRING(200),
    allowNull: false,
    comment: '生产厂家'
  },
  image: {
    type: DataTypes.STRING(500),
    comment: '疫苗图片URL'
  },
  doses: {
    type: DataTypes.INTEGER,
    allowNull: false,
    defaultValue: 1,
    comment: '接种剂次'
  },
  intervals: {
    type: DataTypes.STRING(100),
    comment: '接种间隔'
  },
  description: {
    type: DataTypes.TEXT,
    comment: '疫苗描述'
  },
  notes: {
    type: DataTypes.JSON,
    comment: '注意事项'
  }
}, {
  tableName: 'vaccines',
  timestamps: true,
  underscored: true,
  comment: '疫苗信息表'
});

module.exports = {Vaccine};